package org.ourgrid.discoveryservice.business.requester;

import java.util.ArrayList;
import java.util.List;

import org.ourgrid.common.internal.IResponseTO;
import org.ourgrid.common.internal.RequesterIF;
import org.ourgrid.common.internal.response.LoggerResponseTO;
import org.ourgrid.discoveryservice.business.dao.DiscoveryServiceDAO;
import org.ourgrid.discoveryservice.business.dao.DiscoveryServiceDAOFactory;
import org.ourgrid.discoveryservice.request.DSIsDownRequestTO;

public class DSIsDownRequester implements RequesterIF<DSIsDownRequestTO>{

	public List<IResponseTO> execute(DSIsDownRequestTO request) {
		List<IResponseTO> responses = new ArrayList<IResponseTO>();
		
		DiscoveryServiceDAO discoveryServiceDAO = DiscoveryServiceDAOFactory.getInstance().getDiscoveryServiceDAO();
		discoveryServiceDAO.removeFromNetwork(request.getDsAddress());
		
		responses.add(new LoggerResponseTO("DiscoveryServiceNotificationController.dsIsDown()", LoggerResponseTO.INFO));
		
		return responses;
	}
	
}
